<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Rolltoke extends Model
{

    public function school()
    {
        return $this->hasOne(School::class,'id','school_id')->bind(['name','warehouse']);
    }

    public function toschool()
    {
        return $this->hasOne(School::class,'id','toid');
    }

    public function getProductAttr(string $name)
    {
        if(!empty($name)){
            return json_decode($name,true);
        }else{
            return $name;
        }
    }
}
